﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="login.aspx.vb" Inherits="includes_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

<title>Login Page</title>
<link rel="stylesheet" type="text/css" href="stylesheets/main.css" />
</head>
<body>
    
<%

    Dim userLogin, userPassword As String
    
    Dim myLogin As String = Request.QueryString("login")
    Dim myPassword As String = Request.QueryString("password")
            
    Dim file As String = "xml_users.xml"
        
    Dim xml = Server.CreateObject("Microsoft.XMLDOM")
    xml.async = False
    xml.load(Server.MapPath(file))
      
        
    Dim counter = xml.documentElement.childNodes.length
        
    For i = 0 To (counter - 1)
        
        userLogin = xml.documentElement.childNodes(i).attributes.getNamedItem("login").nodeValue
        userPassword = xml.documentElement.childNodes(i).attributes.getNamedItem("password").nodeValue
        
                
    If myLogin = userLogin Then
        If myPassword = userPassword Then
             
                Session("AccessLevel") = xml.documentElement.childNodes(i).attributes.getNamedItem("role").nodeValue
                Session("Wallpaper") = xml.documentElement.childNodes(i).attributes.getNamedItem("wallpaper").nodeValue
                
        End If
    End If
          
Next
%>

<script type="text/javascript">

window.parent.giveAccess('<%=Session("AccessLevel")%>');
   
</script>

 
</body>
</html>
